<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => {
    assert_not_equals(window.internals, undefined,
        'This test requires window.internals to access clipboard');

    assert_selection(
        [
            '<div contenteditable>',
                '<font color="red">^abc</font>',
                '<div><font color="red">def|</font></div>',
            '</div>',
        ].join(''),
        selection => {
            selection.document.execCommand('copy');
            selection.modify('move', 'forward', 'character');
            selection.document.execCommand('insertParagraph');
            selection.document.execCommand('paste');
        },
        [
            '<div contenteditable>',
                '<font color="red">abc</font>',
                '<div><font color="red">def</font></div>',
                '<div>',
                    '<font color="red">abc</font>',
                    '<div><font color="red">def|</font></div>',
                '</div>',
            '</div>',
        ].join(''),
        'Copy and paste with colored text');
});
</script>
